package main

import (
	"github.com/zw2582/ginlib"
	"log"
	"net"
	"szxf/commands"
	"szxf/models"
	router "szxf/routes"
)

func main() {
	//初始化ini配置
	ginlib.InitIni()

	//初始化日志
	ginlib.InitLogger()

	//初始化redis
	ginlib.InitRedis()

	//初始化数据库
	models.InitDb()

	//执行命令行
	commands.InitCommand()

	//启动gin框架
	r := router.InitRoute()
	host := ginlib.Ini_Str("app.host", "127.0.0.1")
	port := ginlib.Ini_Str("app.port", "8080")

	log.Println("web服务启动, listen:"+host+":"+port)
	r.Run(net.JoinHostPort(host, port))
}
